<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			body{
				counter-reset: section;
				counter-reset: p1;
			}
			h2:before{
				counter-increment: section;
				content: '第' counter(section) ":";
			}
			h3{
				counter-reset: p2;
			}
			h3:before{
				counter-increment: p1;
				content: '第' counter(p1) ":";
			}
			h4:before{
				counter-increment: p2;
				content: '第' counter(p1) "-" counter(p2) ":";
			}
		</style>
	</head>
	<body>
		<h1>css计数器</h1>
		<h2>学习css</h2>
		<h2>学习java</h2>
		<h2>学习javaScript</h2>
		<!--嵌套计数器-->
		<h3>aaaaaa</h3>
		<h4>axxx</h4>
		<h4>axxx</h4>
		<h4>axxx</h4>
	</body>
</html>